<?php
require_once('lib.php');
require_once('form.php');

// получение параметров
$dtype = optional_param('dtype', '', PARAM_TEXT);

if ( $dtype == 'files' OR $dtype == 'users' OR $dtype == 'courses' )
{// пришел валидный параметр - создаем форму
    $url = new moodle_url($CFG->wwwroot."/admin/tool/cleanup/delete.php");
    $customdata = new stdClass();
    $customdata->dtype = $dtype;
    $form = new tool_cleanup_delete_data_form($url->out(), $customdata);
}

// печать шапки
admin_externalpage_setup('toolcleanup');
echo $OUTPUT->header();

// список ссылок
echo "<h4>".get_string('available_actions_list','tool_cleanup').":</h4>";

echo "<ul><li title='".get_string('delete_files_description', 'tool_cleanup')."'>
    <a href='".$CFG->wwwroot."/admin/tool/cleanup/index.php?dtype=files"
    ."'>".get_string('delete_files','tool_cleanup')."</a></li>";
echo "<li title='".get_string('delete_inactive_users_description', 'tool_cleanup')."'>
    <a href='".$CFG->wwwroot."/admin/tool/cleanup/index.php?dtype=users"
    ."'>".get_string('delete_inactive_users','tool_cleanup')."</a></li>";
echo "<li title='".get_string('delete_inactive_courses_description', 'tool_cleanup')."'>
    <a href='".$CFG->wwwroot."/admin/tool/cleanup/index.php?dtype=courses"
    ."'>".get_string('delete_inactive_courses','tool_cleanup')."</a></li></ul>";

if (isset($form))
{
    $form->display();
}

echo $OUTPUT->footer();
?>